package WaiBao;

import java.util.Arrays;

public class HeYuanSha {
    public static void main(String[] args) {
            String[] name = {"杨明政(班长)", "蒋与方(团支书)", "小李(学习委员)", "景小雪(体育委员)", "刘桂玲", "胡正荣", "赖菊花", "谢燕", "冯存茹", "和琼华", "黄敏", "胡正荣",
                    "杨富链", "白莉", "张娜娜", "唐密", "张梅", "于德荣", "杨红", "黄明丽", "吉平", "姜维", "金灵安", "将小于", "康威", "肖成荣", "张莉", "华晨宇",
                    "貂蝉", "贺远莎(学生)"};//考生本人: 贺远莎(学生)
            int[] Age = {20, 19, 18, 21, 20, 21, 21, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 20};//考生年龄：20岁

        double[] huolong1 = {98, 82, 94, 80, 78, 69, 78, 89, 80, 90, 90, 87, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 95};
        double[] huolong2 = {88, 65, 79, 76, 88, 77, 88, 79, 90, 90, 90, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 94};
        double[] huolong3 = {77, 96, 90, 85, 71, 69, 78, 89, 80, 60, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 96};

        double zhongfen;//代表每个学生的总分
        double pingjunfen;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            zhongfen = huolong1[i] + huolong2[i] +huolong3[i];
//            pingjunfen = ( zhongfen * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + zhongfen);
//            System.out.println(name[i] + "的平均分为:" +pingjunfen);
//        }






        double fish1 = 0,fish2 = 0, fish3 = 0;//计算每门课的平均分
        double dog1 = 0,dog2 = 0, dog3 = 0;//计算每门课标准差
        double cat1 = 0, cat2 = 0, cat3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < huolong1.length; i++) {
            sum2+=huolong1[i];
        }
        fish1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+fish1);
        double Sum = 0;
        for (int i = 0; i < huolong2.length; i++) {
            Sum+=huolong2[i];
        }
        fish2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+fish2);
        double sum = 0;
        for (int i = 0; i <huolong3.length; i++) {
            sum+=huolong3[i];
        }
        fish3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+fish3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <huolong1.length; i++) {
            c1+= (huolong1[i] -fish1)*(huolong1[i] - fish1);
        }
        dog1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+dog1);

        for (int i = 0; i < huolong2.length; i++) {
            c2+= (huolong2[i] - fish2)*(huolong2[i] - fish2);
        }
        dog2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+dog2);

        for (int i = 0; i < huolong3.length; i++) {
            c3+= (huolong3[i] -fish3)*(huolong3[i] - fish3);
        }
        dog3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+dog3);
//
//
//        Arrays.sort(huolong1);
//        Arrays.sort(huolong2);
//        Arrays.sort(huolong3);
//        cat1 =( huolong1[14]+huolong1[15])*1.0/2;
//        cat2 =( huolong2[14]+huolong2[15])*1.0/2;
//        cat3 =( huolong3[14]+huolong3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+cat1);
//        System.out.println("微生物学的中位数为:"+cat2);
//        System.out.println("人体组织解剖学的中位数为:"+cat3);

    }
}
